package com.ss.android.common.load;

import java.lang.ref.WeakReference;

final class Node<K, T, E, V, R> extends AbsNode<K, T, E, V, R, V, Node<K, T, E, V, R>> {
    private WeakReference<V> ref;

    final void bindObj(V v) {
        this.ref = v != null ? new WeakReference(v) : null;
    }

    final boolean isEmpty() {
        return this.ref == null || this.ref.get() == null;
    }

    final void clearObj() {
        this.ref = null;
    }

    final void unbindObj(Object v) {
        if (v != null && this.ref != null && v == this.ref.get()) {
            this.ref = null;
        }
    }

    final V getObj() {
        return this.ref != null ? this.ref.get() : null;
    }
}

